package com.ikangtai.shecare.common.baseView.recordButtonView;

import android.content.Context;
import android.graphics.Color;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Button;

import com.ikangtai.shecare.R;

/**
 * Created by Administrator on 2016/1/22.
 */
public class RecordSelectBBTContentButton extends RecordSelectButton{

    private Context context;
    public static final int RECORD_BBT_SELECT_CONTENT_WHITE_BACKGROUND_COLOR = 0;
    public static final int RECORD_BBT_SELECT_CONTENT_BLUE_BACKGROUND_COLOR = 1;
    public static final String RecordSelectContentBBTButtonType="BBTCONTENT";

    public RecordSelectBBTContentButton(Context context){
        super(context);
        this.context=context;
        setType(RecordSelectContentBBTButtonType);
    }
    public RecordSelectBBTContentButton(Context context,AttributeSet attrs){
        super(context,attrs);
        this.context=context;
        this.backgroundColor = RECORD_BBT_SELECT_CONTENT_WHITE_BACKGROUND_COLOR;
    }
    @Override
    public void setColor(int backGroundColor) {
        super.setColor(backGroundColor);
        if(backGroundColor == RECORD_BBT_SELECT_CONTENT_WHITE_BACKGROUND_COLOR){
            this.setBackground(getResources().getDrawable(R.drawable.record_temperature_button_default));
            this.setTextColor(getResources().getColor(R.color.lpq_color));
        }else if(backGroundColor == RECORD_BBT_SELECT_CONTENT_BLUE_BACKGROUND_COLOR){
            this.setBackground(getResources().getDrawable(R.drawable.record_temperature_button_pressed));
            this.setTextColor(Color.WHITE);
        }
    }

    @Override
    public void clickAction(View view) {
        RecordSelectButton recordTemperatureRecordBtn;
        RecordSelectButton recordTemperatureTimeBtn;
        Button recordTemperatureConfirmAddBtn;
        if(null!=view&&backgroundColor==RECORD_BBT_SELECT_CONTENT_WHITE_BACKGROUND_COLOR){
            recordTemperatureRecordBtn=(RecordSelectBBTContentButton)view.findViewById(R.id.record_temperature_add_temperature_btn);
            recordTemperatureTimeBtn=(RecordSelectBBTContentButton)view.findViewById(R.id.record_temperature_add_time_btn);
            recordTemperatureConfirmAddBtn=(Button)view.findViewById(R.id.record_temperature_add_confirm_btn);
            if(backgroundColor == RECORD_BBT_SELECT_CONTENT_WHITE_BACKGROUND_COLOR){
                this.setBackground(getResources().getDrawable(R.drawable.record_temperature_button_pressed));
                this.setTextColor(Color.WHITE);
                backgroundColor = RECORD_BBT_SELECT_CONTENT_BLUE_BACKGROUND_COLOR;
                if(recordTemperatureRecordBtn.getColor()==RECORD_BBT_SELECT_CONTENT_BLUE_BACKGROUND_COLOR){
                    recordTemperatureConfirmAddBtn.setBackground(getResources().getDrawable(R.drawable.record_temperature_button_default));
                    recordTemperatureConfirmAddBtn.setTextColor(getResources().getColor(R.color.lpq_color));
                    }else{

                }

            }
        }

    }
}
